import { http } from "@/utils/http";
import type {
  AppConfig,
  AppConfigName,
  HomeRecommendItem,
  TodayRecommendItem
} from "types/app-config";

export const getAppConfig = (name: AppConfigName) => {
  return http.request<AppConfig>("get", "/config", {
    params: {
      name
    }
  });
};

export const updateAppConfig = (data: { name: AppConfigName; data: any }) => {
  return http.request<AppConfig>("put", "/config", {
    data
  });
};

export const getWexinTodayRecommend = () => {
  return http.request<TodayRecommendItem[]>(
    "get",
    "/config/weixin-today-recommend"
  );
};

export const getWexinHomeRecommend = () => {
  return http.request<HomeRecommendItem[]>(
    "get",
    "/config/weixin-home-recommend"
  );
};
